<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<%@include file="jxInclude.jsp"%>
<%@include file="jsInclude.jsp"%>
<%@include file="cssInclude.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>生活部落后台管理系统</title>
<style>
.MAIN{
	width: 950px
}
.fwMainBox{
	width:950px;
	height:650px
}
.splitterBox {
  display: block;
  position: relative;
  background: #f0f0f0;  
  margin: 0px 10px;
  padding: 4px;
  width: 950px;
  height: 650px;
  border-top: 1px solid #f0f0f0;
  border-left: 1px solid #f0f0f0;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
}

</style>
<script language='javascript'>
	window.addEvent('load', function(){
		init();
	});
	var qxJson = "{\"sys\":[[\"指标管理\",\"<%=request.getContextPath()%>/indicate.do\",\"sys_1\"],[\"sys_item2\",\"www.sina.com\",\"sys_2\"],[\"sys_item3\",\"www.sina.com\",\"sys_3\"]],\"cms\":[[\"cms_item1\",\"www.eeo.com.cn\",\"cms_1\"]],\"clan\":[[\"clan_item\",\"blank\",\"clan_1\"]]}";
	var jxPath = "<%=jxPath%>";
	var rightTabBox;
	function init(){
		var splitH = new Jx.Splitter('fwMain',{containerOptions: [null,{width:820}]});
	    var splitV1 = new Jx.Splitter(splitH.elements[0], {
	        layout: 'vertical',
	        containerOptions: [{height:450,width:100}]
	    });
	    var splitV2 = new Jx.Splitter(splitH.elements[1], {
	        layout: 'vertical',
	        containerOptions: [{height:450}]
	    });
	    rightTabBox = new Jx.TabBox({parent:splitV2.elements[0]});
	    //初始化菜单
	    var leftMenu = new Jx.Tree({parent:splitV1.elements[0]});
	    var leftMenuRoot = new Jx.TreeFolder({label:"生活部落"});
	    leftMenu.append(leftMenuRoot);
	    var qxObj = eval('('+qxJson+')');
	    var qx_sys = qxObj.sys;
	    var sysMenu = new Jx.TreeFolder({label:'系统设置'});
	    leftMenuRoot.append(sysMenu);
	    parseQx(qx_sys,sysMenu);
	    
	    var qx_cms = qxObj.cms;
	    var cmsMenu = new Jx.TreeFolder({label:'内容管理'});
	    leftMenuRoot.append(cmsMenu);
	    parseQx(qx_cms,cmsMenu);
	    
	    var qx_clan = qxObj.clan;
	    var clanMenu = new Jx.TreeFolder({label:'部落管理'});
	    leftMenuRoot.append(clanMenu);
	    parseQx(qx_clan,clanMenu);
	    var qx_note = qxObj.note;
	    var noteMenu = new Jx.TreeFolder({label:'日志管理'});
	    leftMenuRoot.append(noteMenu);
	    parseQx(qx_note,noteMenu);
	    //--初始化菜单完毕--//

	    var leftPanel = new Jx.Panel({
				label:'系统公告',
				width:120,
				minWidth:80,
				height:200,
				parent: splitV1.elements[1]
		});

		

		var rightPaenl = new Jx.Panel({
				label:'操作日志',
				parent:splitV2.elements[1],
				height:200,
				minHeight:100
			});

		var defaultBt = new Jx.Button.Tab({label:'控制面板',active:true,close:true,contentURL:'/platfrom/test.html'});
		rightTabBox.add(defaultBt);
	}
	function parseQx(qxObjItem,parentNode){
		if(qxObjItem != null && qxObjItem != undefined && qxObjItem.length > 0){
			for(var i = 0; i < qxObjItem.length;i++){
				var treeItem = new Jx.TreeItem({label:qxObjItem[i][0],onClick:function(){createTabT(this,qxObjItem)}});//createTab(itemSubTitle,itemSubClick)
				parentNode.append(treeItem);
			}
		}else{
			return null;
		}
	}
	function createTabT(ti,qxObj){
		var _tiN = ti.getName();
		for(var i = 0; i < qxObj.length;i++){
			var itemSub = qxObj[i];
			var itemSubTitle = itemSub[0];
			var itemSubClick = itemSub[1];
			var itemSubId = itemSub[2]; 
			if(itemSubTitle == _tiN){
				createTab(itemSubTitle,itemSubClick,itemSubId);
			}else{
				continue;
			}
		}
	}
	function createTab(_tabName,_tabURL,_tabId){
		var ifExist = false;
		for(var i = 0; i < rightTabBox.tabSet.tabs.length; i++){
			var _t_bT = rightTabBox.tabSet.tabs[i];
			if(_t_bT.options.label == _tabName){
				_t_bT.setActive(true);
				ifExist = true;
				break;
			}
		}
		if(!ifExist){
			var bT = new Jx.Button.Tab({
				label:_tabName,
				active:true,
				close:true,
				contentURL:_tabURL
			});
			
			rightTabBox.add(bT);
		}
	}
</script>
<body>
	<DIV class=main>
		<div id="fwMain" class="fwMainBox splitterBox"></div>
	</DIV>
</body>
</html>